package com.yuye.cloud.common.exception;

import com.yuye.cloud.common.model.AgqConstant;

/**
 * 异常信息实体类
 * @author gzs
 * @version 3.0.0
 *
 */
public class MyException extends RuntimeException {

    /**
	 * TODO 添加字段注释
	 */
	private static final long serialVersionUID = 8175635956365089734L;
	/**
     * 错误编码
     */
    private Integer code;
    /**
     * 错误提示
     */
    private String msg;
    /**
     * 错误信息
     */
    private Exception exception;

    /**
     * 异常信息
     *
     * @param msg 异常信息
     * @param e 异常抛出
     */
    public MyException(final String msg, final Exception e) {
        super(msg);
        this.code = AgqConstant.ABNORMAL;
        this.msg = msg;
        this.exception = e;
    }

    /**
     * 警告信息
     * @param msg 警告信息
     */
    public MyException(final String msg) {
        super(msg);
        this.code = AgqConstant.WARNING;
        this.msg = msg;
    }

    /**
     * 自定义code信息
     * @param msg 错误信息
     * @param code code信息
     */
    public MyException(final String msg, final Integer code) {
        super(msg);
        this.code = code;
        this.msg = msg;
    }

	public Integer getCode() {
		return code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public Exception getException() {
		return exception;
	}

	public void setException(Exception exception) {
		this.exception = exception;
	}

    
}
